package client

import (
	"fmt"
	"google.golang.org/grpc"
	pb "week3zk-project/rpc/api/goods"
)

func Client() pb.GoodsClient {
	// 1.连接
	conn, err := grpc.Dial("127.0.0.1:8081", grpc.WithInsecure())
	if err != nil {
		fmt.Printf("连接异常： %s\n", err)
	}
	//defer conn.Close()
	// 2. 实例化gRPC客户端
	client := pb.NewGoodsClient(conn)
	// 3.组装请求参数
	return client
}
